public class Strings
{
   /**
      Gets the middle character or character pair from this string 
      when possible.
      @param str a string
      @return the middle character (if the string length is odd) or
      the middle two characters (if it is even), or the empty string if str is
      empty.
   */
   public static String getMiddle(String str)
   {
	 int lens=str.length();
      String st="";
      if(lens==0) return "";
      if(lens%2==1)
      {
         st+=str.charAt(lens/2);
         return st;
      }
      else
      {
         st+=str.charAt(lens/2-1);
         st+=str.charAt(lens/2);
         return st;
      }
    }
}